1 Learning objectives 🎯
- Understand the structure of the Quarto notebook
- Understand the difference and relationships between notebooks and rendered documents
2 Quarto notebooks vs. rendered documents
A Quarto notebook and its corresponding rendered document(s) serve different purposes but are closely connected.
- The Quarto notebook is the source document where content is defined.
- The rendered document is the output generated from the Quarto notebook. Common rendered document formats include:
- HTML for interactive web-based reports.
- PDF for professional and printable documents.
- Word for editable text-based outputs.
A single Quarto notebook can be rendered into multiple formats. While there may be some limitations when targeting different formats, this flexibility is one of Quarto’s core strengths, making it a powerful tool for creating versatile and reusable documents.
3 Structure of a Quarto notebook
There are three basic components to a Quarto notebook:
- a unique (YAML) header,
- (markdown) text areas, and
- code areas (and their output).
At the top of the Quarto notebook, you will see something that looks as follows:
This section is called the YAML header and it contains commands and metadata about the Quarto notebook. There is only one unique header in a Quarto notebook and it is always surrounded by --- lines on the top and bottom of the section.
YAML is a data format that has the form of a key: value pairing to store data. The keys in this case are title and format; they are are some of many settings that Quarto has available to use. The values are those that follow the key (e.g., “Untitled” for title). These key data are used to store the settings that Quarto will use to render the output document.
More HTML options: HTML Options
In white background areas, you find Markdown text which will appear as regular text in the rendered document.
Markdown is actually a markup language, which can have formatting such as headings, italics, bold, numbers, and bullets.
Code chunks, typically shown within gray backgrounds, execute commands in Quarto.
In the example provided, R code is being run and identified with the {r} tag. These commands may handle data processing, cleaning, or the generation of visual outputs that are integrated into the final document.
4 Structure of a rendered document
The rendered document translates the notebook’s structure, content, and code outputs into a polished, static format for presentation or sharing.